﻿using ShanNiang.Service.Constants;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace ShanNiang.Mvvm.ValidateRules
{
    public class SmsCodeRule : ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            var inputValue = (string)value;
            if (!string.IsNullOrWhiteSpace(inputValue))
            {
                if (CommonData.Regex_SmsCode.IsMatch(inputValue))
                {
                    return ValidationResult.ValidResult;
                }
            }
            return new ValidationResult(false, "请输入正确的验证码");
        }
    }
}
